<ui:composition
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core">

<!--<div id="header" class="header" >-->

    <h:panelGroup layout="block" id="header" styleClass="header"  >

    <div id="header-logo">

        <div style="position: relative; width: 100%; float: left; top: 15px;" >

            <h:form prependId="false" id="fHeader" >
                <h:commandLink id="lnkHome" action="/global/index.xhtml" immediate="true"  >
                    <h:graphicImage value="../../TiendaVirtual/iconos/intercap.png"  alt="Intercap S.R.L."
                                    width="170" />
                </h:commandLink>
                <p:tooltip for="lnkHome" value="Ir a la pantalla principal"  showEffect="fade" hideEffect="fade" />
            </h:form>
        </div>
    </div>
    
   <ui:insert name="infoCarrito">

       <h:form prependId="false" id="informacionCarrito"  >
           <c:if test="#{usuarioSessionBean.estaRegistrado}" >
               <div id="header-right">
                   <ui:include src="../facturacion/carritoInformacion.xhtml" />
               </div>
           </c:if>
       </h:form>
        
    </ui:insert>

    <ui:insert name="loginUsuario">

        <c:choose>
            <c:when test="#{usuarioSessionBean.estaRegistrado}">
                <div id="header-menu" >
                    <c:choose>
                        <c:when test="${usuarioSessionBean.usuario.tipo =='A'}">
                            <ui:include src="../seguridad/menu_administrador.xhtml"  />
                        </c:when>
                        <c:when test="${usuarioSessionBean.usuario.tipo =='V'}">
                            <ui:include src="../seguridad/menu_vendedor.xhtml"  />
                        </c:when>
                        <c:when test="${usuarioSessionBean.usuario.tipo =='S'}">
                            <ui:include src="../seguridad/menu_sai.xhtml"  />
                        </c:when>
                        <c:when test="${usuarioSessionBean.usuario.tipo =='C'}">
                            <ui:include src="../seguridad/menu_usuario.xhtml"  />
                        </c:when>
                        <c:when test="${usuarioSessionBean.usuario.tipo =='P'}">
                            <ui:include src="../seguridad/menu_usuario.xhtml"  />
                        </c:when>
                    </c:choose>
                </div>
                
            </c:when>            

            <c:when test="#{not usuarioSessionBean.estaRegistrado}">

                <h:form id="fLogin" prependId="false">

                    <p:growl showDetail="true"  />

                    <div style="width: 270px; height: 45px; float: right;  position: relative;
                         margin-top: 13px; text-align: right; ">

                    <div>
                        <p:inputText id="txtUsuario" value="#{usuarioSessionBean.usuario.nombre}"
                                 required="true"
                                 requiredMessage="El usuario es obligatorio" size="13" >
                            <f:validateLength minimum="4" maximum="20" />
                        </p:inputText>
                        <!--<p:watermark for="txtUsuario" value="Usuario" />-->

                        <p:spacer width="5" height="10" />

                        <p:password value="#{usuarioSessionBean.usuario.password}" feedback="false" id="txtPassword"
                                maxlength="20" required="true"
                                requiredMessage="La clave es obligatoria" size="13"
                                 />
                        <!--<p:watermark for="txtPassword" value="Clave" />-->

                        <p:spacer width="5" height="10" />

                        <p:commandButton icon="ok16" value="Ingresar" ajax="false" style="font-weight: bold; font-size: 10px;"
                                    action="#{usuarioSessionBean.login}"
                                    onclick="ajaxStatus3.show()"  />

                    </div>

                    <div style="text-align: center; margin: 5px;">

                        <p:commandLink value="Olvidé mi clave" style="font-weight: bold; font-size: 12px; color: #000066;"
                                       immediate="true"
                                    action="#{usuarioSessionBean.verRecuperarPassword}"
                                    ajax="false"
                                    onclick="ajaxStatus3.show()" />

                    </div>

                </div>
                </h:form>
            </c:when>
        </c:choose>

    </ui:insert>

    </h:panelGroup>

<!--</div>-->

<!--<p:sticky target="header" />-->

</ui:composition>
